home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-15 | 4.7 KB | 190 lines | [TEXT/MPS ] |
- // AGSampleCode.h
- // Copyright 1996, Apple Computer, Inc.
- // Date: 23-Jan-96
- // Author: guideWorks, LLC
- // Web: http://www.guideworks.com
- // EMail: powers@guideworks.com
- //
- // This file contains the headers for the Apple Guide sample code.
-
- #ifndef __APPLEGUIDE__
- #include <AppleGuide.h>
- #endif
- #ifndef __ASREGISTRY__
- #include "ASRegistry.h"
- #endif
- #ifndef __AGFILE__
- #include "AGFile.h"
- #endif
-
- // ---------- Constants ---------------------------------------------------
-
- #define kAGSTargetAppSignature 'AGS2'
- #define kAGSOpenGuideId 1001
- #define kAGSOpenGuideWithSearchId 1002
- #define kAGSCheckSelectorDocumentAny 1
- #define kAGSCheckSelectorControlFront 2
- #define kAGSCheckSelectorControlTrue 3
- #define kAGSSearchPhraseID 1001
- #define kAGSContextCodeResSpec 'agsd'
- #define kAGSAEventClass 'agse'
- #define kAGSAEventOpenNewDocument 'agsw'
- #define kAGSAEventCloseDocument 'agsx'
- #define kAGSDocSFType 'AGSD'
- #define cAGSASCoachItem 'agsc'
- #define pAGSASCoachRect 'agsr'
-
- // ---------- Data structures ---------------------------------------------
-
- // Data structure passed to context check.
- // Guide Script:
- // <Define Context Check> "IsAnyDocumentOpen", 'agsd', 'AGS2', LONG:1, LONG:0
- // <Define Context Check> "IsThisControlFront", 'agsd', 'AGS2', LONG:2, LONG
- // <Define Context Check> "IsThisControlTrue", 'agsd', 'AGS2', LONG:3, LONG
- typedef struct
- {
- long checkSelector; // 1, 2, or 3
- long itemIdentifier; // The id number for the item of interest.
- } InputDataType, *InputDataPtr, **InputDataHan;
-
- // ---------- AGSample Prototypes -------------------------------------------------
-
- void
- AGSInstall();
-
- void
- AGSRemove();
-
- OSErr
- AGSInstallCoachHandler();
-
- pascal OSErr
- AGSCoachReplyProc(Rect* pRect, Ptr name, long refCon);
-
- OSErr
- AGSRemoveCoachHandler();
-
- OSErr
- AGSInstallContextHandler();
-
- OSErr
- AGSRemoveContextHandler();
-
- pascal OSErr
- AGSContextReplyProc(Ptr pInputData, Size inputDataSize,
- Ptr *ppOutputData, Size *pOutputDataSize,
- AGAppInfoHdl hAppInfo);
-
- OSErr
- AGSInstallAEHandler();
-
- OSErr
- AGSRemoveAEHandler();
-
- pascal OSErr
- AGSHandleAEvents(AppleEvent* theAppleEvent,
- AppleEvent* theReply, long refCon);
-
- OSErr
- AGSOpenGuide();
-
- OSErr
- AGSOpenGuideWithSearch(short searchPhraseIndex);
-
- OSErr
- AGSGetAppFSSpec(FSSpec* pFileSpec);
-
-
- OSErr
- AGSInstallASCoachHandlers();
-
- OSErr
- AGSRemoveASCoachHandlers();
-
- pascal OSErr
- AGSHandleGetData(AppleEvent* theAppleEvent,
- AppleEvent* reply,
- long refCon);
-
- OSErr
- AGSGetDataItemCoachRect(AEDesc* token, AEDesc* pResult);
-
- pascal OSErr
- AGSCoachItemAccessor( DescType desiredClass,
- AEDesc* containerToken,
- DescType containerClass,
- DescType keyForm,
- AEDesc* keyData,
- AEDesc* resultToken,
- long refCon);
-
- pascal OSErr
- AGSCoachItemPropertyAccessor( DescType desiredClass,
- AEDesc* containerToken,
- DescType containerClass,
- DescType keyForm,
- AEDesc* keyData,
- AEDesc* resultToken,
- long refCon);
-
- OSErr
- AGSIsMissingParams(AppleEvent* theAppleEvent);
-
- OSErr
- AGSDescToLong(const AEDesc* desc, long* pLongValue);
-
- OSErr
- AGSDescToPString(const AEDesc* desc, StringPtr pStr, short maxLength);
-
- // ---------- Apps-To-Go Prototypes -------------------------------------------------
-
- // constants for Apps-To-Go
- struct FileRec;
- typedef struct FileRec *FileRecPtr, **FileRecHndl;
- void
- #define kMinHeap 64 * 1024 /* Needs at least 64k of heap space. */
- #define kMinSpace 64 * 1024 /* Needs this much after calling PurgeSpace. */
- // Apps-To-Go calls to Apps-To-Go (overrides)
- ContentClick(WindowPtr window, EventRecord *event, Boolean firstClick);
- // AGSample calls to Apps-To-Go
- long
- c2dec(char *cptr, short *charsUsed);
- WindowPtr
- GetNextDocumentWindow(WindowPtr window, OSType sftype);
- Rect
- GetWindowContentRect(WindowPtr window);
- short
- CNum2Ctl(WindowPtr window, short ctlNum, ControlHandle *ctl);
- short
- GetWindowCount(Boolean includeDAs, Boolean includeDLOGs, Boolean includeInvisibles);
- OSErr
- NewDocument(FileRecHndl *returnHndl, OSType sftype, Boolean incTitleNum);
- OSErr
- DoNewWindow(FileRecHndl frHndl, WindowPtr *retWindow, WindowPtr relatedWindow, WindowPtr behind);
- Boolean
- DisposeOneWindow(WindowPtr window, short saveMode);
- short
- IsCtlEvent(WindowPtr window, EventRecord *event, ControlHandle *ctl, short *action);
- // main calls to Apps-To-Go
- void
- InitATGLIB(void);
- void
- Initialize(short moreMasters, long minHeap, long minSpace, ProcPtr init1, ProcPtr init2);
- CursPtr
- DoSetResCursor(short crsrID);
- OSErr
- InitRequiredAppleEvents(void);
- OSErr
- DoOpenApplication(void);
- OSErr
- GetWindowFormats(void);
- OSErr
- ReadPreferences(OSType prefType, OSType prefCreator, short prefLocID);
- OSErr
- OpenRuntimeOnlyAutoNewWindows(void);
- void
- DoAdjustMenus(void);
- void
- EventLoop(void);
- OSErr
- WritePreferences(void);